#include "../include/file.h"

bool file_exists(char *filename){
	return (access(filename, F_OK) == 0) ? true : false;
}

bool is_dir(char *filename){
	DIR *dp;

	if((dp=opendir(filename)) != NULL){
		closedir(dp);

		return true;
	}

	return false;
}

bool is_readable(char *filename){
	return (access(filename, R_OK) == 0) ? true : false;
}

bool is_writable(char *filename){
	return (access(filename, W_OK) == 0) ? true : false;
}

bool is_executable(char *filename){
	return (access(filename, X_OK) == 0) ? true : false;
}
